<?php
/**
 * Az osztály rövid leírása
 *
 * Az osztály hosszú leírása, példakód
 * akár több sorban is
 * 
 * @package
 * @author gabi
 * @since 2014.04.03. 13:59
 */ 

abstract class Worker {

    /**
     * @var string
     */
    protected $name = '';

    /**
     * @var int
     */
    protected $age = 0;

    /**
     * @var int
     */
    protected $wage = 400;  //!!!

    /**
     * @var int
     */
    protected $workedHours = 0;

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getAge()
    {
        return $this->age;
    }

    /**
     * @param mixed $age
     */
    public function setAge($age)
    {
        $this->age = $age;
    }

    /**
     * @return int
     */
    public function calculatePayment()
    {
        return $this->wage * $this->workedHours;
    }

    /**
     * @return mixed
     */
    public function getHours()
    {
        return $this->workedHours;
    }

    /**
     * @param $hours
     */
    public function setHours($hours)
    {
        $this->workedHours = intval($hours);
    }

    /**
     * Persist entity to database
     */
    public function save()
    {
        EntityManager::save($this);
    }

    /**
     * Delete entity form database
     */
    public function delete()
    {
        EntityManager::save($this);
    }
} 